﻿/*
This project and all of its code is/are Copyright (C) 2017  Nils Hunter Alving

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicTypeBuilder.ConstrainedType.Examples
{
    /// <summary>
    /// A representation of the prime numbers below 20
    /// This is an example class for usage of the ConstrainedTypeBase 
    /// </summary>
    public class PrimeNumbers : ConstrainedTypeBase<int>
    {
        public const int One = 1;
        public const int Three = 3;
        public const int Five = 5;
        public const int Seven = 7;
        public const int Eleven = 11;
        public const int Thirteen = 13;
        public const int Seventeen = 17;
        public const int Nineteen = 19;

        private static List<int> PossibleValues = new List<int>()
        {
            One,
            Three,
            Five,
            Seven,
            Eleven,
            Thirteen,
            Seventeen,
            Nineteen
        };

        /// <summary>
        /// Default constructor
        /// </summary>
        public PrimeNumbers() : base(PossibleValues)
        {
        }

        public static implicit operator PrimeNumbers(int number)
        {
            return new PrimeNumbers()
            {
                Value = number
            };
        }
    }
}
